package com.yuye.java.redis.config;

import org.redisson.Redisson;
import org.redisson.api.RLock;
import org.redisson.api.RedissonClient;
import org.redisson.config.Config;

/**
 * Reddison测试类
 * @author gzs
 */
public class TestReddison {
	
	public static void main(String[] args) {
		Config config = new Config();
		config.useSingleServer()
		    .setAddress("redis://82.156.48.201:6381")
		    .setPassword("xiegaofeng");

		RedissonClient redisson = Redisson.create(config);

		RLock lock = redisson.getLock("anyLock");

		lock.lock();
		lock.unlock();
		
		
		RLock fairLock = redisson.getFairLock("gongpingsuo_anyLock");
		fairLock.lock();
		fairLock.unlock();
	}

}
